package com.igor.bookStore.tapestry.pages;

import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.igor.bookStore.inface.Book;
import com.igor.bookStore.service.Books;

public class ViewBook {
	
	@Inject
    @Property
    private Books books;
    
    @Property
    private Book currentBook;
    
    @InjectPage
    private BookDetails bookDetailsPage;
    
    @OnEvent(component="bookDetailsLink")
    public Object onShowDetails(String name)
    {
            Book chosenBook = books.retrieveSingleBook(name);
            bookDetailsPage.setChosenBook(chosenBook);
            return bookDetailsPage;
    }
    
    
    


}
